/**
 * @file net.h
 *
 * The <b>net<b/> module contains utility functions for interacting with the network: creating sockets, opening/closing TCP connections.
 */

#ifndef _TCP_H
#define _TCP_H

#include "node.h"
#include "addr.h"
#include "msg.h"

int socket_create(const Node *node, int type, int port);
int socket_close(const Node *node, int sock);
int socket_create_dst(const Node *node, int type, const char *dst_ip, int dst_port, int timeout);
int tcp_socket_create(const Node *node, const Addr *dst);
int udp_socket_create(const Node *node, const Addr *dst);
int readt(const Node *node, int fd, char *buf, int count, int timeout);
int writet(const Node *node, int fd, char *buf, int count, int timeout);

#endif /* _TCP_H */
